package 华为.text33_整数转ip地址;

import java.util.Scanner;

public class Main2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        String[] split = s.split("\\.");
        long l = scanner.nextLong();
        long l1=0;
        for (int i = 0; i < split.length; i++) {
            l1+=Integer.valueOf(split[i])*Math.pow(256,(split.length-1-i));
        }
        System.out.println(l1);

        String[] strings = new String[4];
        for (int i = 0; i < 4; i++) {
            strings[3-i]=String.valueOf(l%256);
            l=l/256;
        }

        System.out.print(strings[0]);

        for (int i = 1; i <= 3; i++) {
            System.out.print("."+strings[i]);
        }


    }
}
